package com.dsw.demo.rabbitmq.service;

import com.dsw.demo.rabbitmq.config.DelayRabbitMQConfig;
import com.dsw.demo.rabbitmq.config.DirectRabbitMQConfig;
import com.dsw.demo.rabbitmq.entity.TaskInfo;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import javax.sound.midi.Soundbank;
import java.text.SimpleDateFormat;
import java.util.Date;

@Component
public class DelayReceiver {

    @RabbitListener(queues = DelayRabbitMQConfig.DELAY_QUEUE)
    public void directReceiver(TaskInfo taskInfo) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println("消费 delay message: " + taskInfo.toString() + "  " + sdf.format(new Date()));
    }

}
